package com.sxc.request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

@WebServlet("/ser06")
public class Servlet06 extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Servlet06...");
        //获取域对象内容
        String name = (String) req.getAttribute("name");
        Integer age = (Integer) req.getAttribute("age");
        List<String> list = (List<String>) req.getAttribute("list");
        System.out.println("name: " + name);
        System.out.println("age: " + age);
        System.out.println("list: " + Arrays.toString(list.toArray()));
    }
}
